package com.github.jcooky.structure;

public class NodeListStack implements Stack {
	private NodeList list;
	
	public NodeListStack(NodeList list) {
		this.list = list;
	}

	public int size() {
		return list.size();
	}

	public boolean isEmpty() {
		return list.isEmpty();
	}

	public Object top() throws EmptyStackException {
		return list.last().element();
	}

	public void push(Object o) {
		list.addLast(o);
	}

	public Object pop() throws EmptyStackException {
		return list.remove(list.last());
	}
	
	public Iterator iterator() {
		return list.iterator();
	}
}
